package com.android.tripspins.app.helper;

import android.app.Activity;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by João.Rutkoski on 28/11/13.
 */
public class PreferencesHelper {

    static SharedPreferences settings;

    public static int getSharedPreference(Activity activity, String key, int defaultValue)
    {
        settings = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
        return settings.getInt(key, defaultValue);
    }
    public static String getSharedPreference(Activity activity, String key, String defaultValue)
    {
        settings = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
        return settings.getString(key, defaultValue);
    }
    public static boolean getSharedPreference(Activity activity, String key, boolean defaultValue)
    {
        settings = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
        return settings.getBoolean(key, defaultValue);
    }

    public static boolean isOnOnlineMode(Activity activity)
    {
        settings = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
        return settings.getBoolean("pref_key_internet_connection", false);
    }
}
